﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyRapChieuPhim.DTO;
using QuanLyRapChieuPhim.BUS;
using QuanLyRapChieuPhim.DAO;


namespace QuanLyRapChieuPhim.GUI
{
    public partial class uscQuanLy : UserControl
    {
        bool XemDaXoa = false;
        bool IsLoaded = false;

        //==============================EVENT=========================================================

        public uscQuanLy()
        {
            InitializeComponent();
        }

        private void uscQuanLy_Load(object sender, EventArgs e)
        {
            IsLoaded = false;
            LoadDanhSach();
            Setup_dgv();
            btnDanhSachDaXoa.BackColor = Color.Red;
            IsLoaded = true;
            dgvQuanLy.Select();
            Load_pnThongTin();
        }

        private void btnXoa_Click(object sender, EventArgs e)
        {
            IsLoaded = false;
            SetDefault_Chon();
            if (DemChon() == 0)
            {
                MessageBox.Show("Không có dòng nào được chọn.", "Thông báo");
                return;
            }
            else
            {
                DialogResult re = MessageBox.Show("Có thể có dữ liệu liên quan, Bạn thật sữ muốn xóa?","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
                if (re == DialogResult.Cancel)
                    return;
                else
                {
                    if (DemXoaHan() > 0)
                    {
                        re = MessageBox.Show("Xóa mãi mãi những dữ liệu này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.None);
                        if (re == DialogResult.Yes)
                        {
                            Xoa();
                            LoadDanhSach_DaXoa();
                            Setup_dgv();
                        }
                    }
                    else
                    {
                        Xoa();
                        LoadDanhSach();
                        Setup_dgv();
                    }
                }
            }
            IsLoaded = true;
        }

        private void btnBoXoa_Click(object sender, EventArgs e)
        {
            IsLoaded = false;
            SetDefault_Chon();
            if (XemDaXoa == true)
            {
                if (DemChon() == 0)
                {
                    MessageBox.Show("Không có dòng nào được chọn.", "Thông báo");
                    return;
                }
                else
                {

                    BoXoa();
                    LoadDanhSach_DaXoa();
                    Setup_dgv();
                    MessageBox.Show("Khôi phục thành công !.", "Thông báo");
                }
            }
            IsLoaded = true;
        }

        private void btnLamTuoi_Click(object sender, EventArgs e)
        {
            IsLoaded = false;
            if (XemDaXoa == true)
            {
                LoadDanhSach_DaXoa();
                Setup_dgv();
            }
            else
            {
                LoadDanhSach();
                Setup_dgv();
            }
            IsLoaded = true;
        }

        private void btnDanhSachDaXoa_Click(object sender, EventArgs e)
        {
            try
            {
                IsLoaded = false;
                if (XemDaXoa == true)
                {
                    btnDanhSachDaXoa.Text = "Xem danh sách đã xóa";
                    btnDanhSachDaXoa.BackColor = Color.Red;
                    btnDanhSachDaXoa.ForeColor = Color.Black;
                }
                else
                {
                    btnDanhSachDaXoa.Text = "Xem danh sách chưa xóa";
                    btnDanhSachDaXoa.BackColor = Color.MediumBlue;
                    btnDanhSachDaXoa.ForeColor = Color.White;
                }
                XemDaXoa = (XemDaXoa == true) ? false : true;

                if (XemDaXoa == true)
                {
                    dgvQuanLy.Columns.Clear();
                    LoadDanhSach_DaXoa();
                    Setup_dgv();
                }
                else
                {
                    dgvQuanLy.Columns.Clear();
                    LoadDanhSach();
                    Setup_dgv();
                }
                btnLamTuoi_Click(sender, e);
                IsLoaded = true;
            }
            catch (Exception)
            {
                return;
            }
        }

        private void dgvQuanLy_SelectionChanged(object sender, EventArgs e)
        {
            if (IsLoaded)
            {
                if (dgvQuanLy.SelectedRows.Count > 0)
                {
                    string colname = LayTenCot();
                    int id = int.Parse(dgvQuanLy.SelectedRows[0].Cells[colname].Value.ToString());
                    ThongTin(id);
                }
            }
        }

        private void dgvQuanLy_DoubleClick(object sender, EventArgs e)
        {
            SetDefault_Chon();
            if (dgvQuanLy.CurrentRow.Cells["Chon"].Value == "No")
                dgvQuanLy.CurrentRow.Cells["Chon"].Value = "Yes";
            else dgvQuanLy.CurrentRow.Cells["Chon"].Value = "No";
        }

        private void btnTim_Click(object sender, EventArgs e)
        {
            string Ten = txtTimTen.Text;
            if (!XemDaXoa)
            {
                TimTheoTen_QL(Ten);
                Setup_dgv();
            }
            else
            {
                TimTheoTen_QL_DaXoa(Ten);
                Setup_dgv();
            }
        }

        //===============================PROCESS========================================================

        private void Setup_dgv_TTMuaVe()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);
               
            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenKhachHang"].HeaderText = "Khách hàng";
            dgvQuanLy.Columns["CMND"].HeaderText = "CMND";
            dgvQuanLy.Columns["MaVe"].HeaderText = "Mã vé";
            dgvQuanLy.Columns["HangGhe"].HeaderText = "Hàng ghế";
            dgvQuanLy.Columns["DayGhe"].HeaderText = "Dãy ghế";
            dgvQuanLy.Columns["GiaVe"].HeaderText = "Giá vé";
            dgvQuanLy.Columns["GioiTinh"].HeaderText = "Giới tính";
            dgvQuanLy.Columns["DiaChi"].HeaderText = "Địa chị";
            dgvQuanLy.Columns["DienThoai"].HeaderText = "Điện thoại";
            dgvQuanLy.Columns["TenSuatChieu"].HeaderText = "Suất chiếu";
            dgvQuanLy.Columns["MaTTMuaVe"].HeaderText = "Mã TT mua vé";
            dgvQuanLy.Columns["MaKhachHang"].HeaderText = "Mã khách hàng";
            dgvQuanLy.Columns["MaSuatChieu"].HeaderText = "Mã suất chiếu";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 14;
            dgvQuanLy.Columns["TenKhachHang"].DisplayIndex = 1;
            dgvQuanLy.Columns["CMND"].DisplayIndex = 2;
            dgvQuanLy.Columns["MaVe"].DisplayIndex = 3;
            dgvQuanLy.Columns["HangGhe"].DisplayIndex = 4;
            dgvQuanLy.Columns["DayGhe"].DisplayIndex = 5;
            dgvQuanLy.Columns["GiaVe"].DisplayIndex = 6;
            dgvQuanLy.Columns["GioiTinh"].DisplayIndex = 7;
            dgvQuanLy.Columns["DiaChi"].DisplayIndex = 8;
            dgvQuanLy.Columns["DienThoai"].DisplayIndex = 9; ;
            dgvQuanLy.Columns["TenSuatChieu"].DisplayIndex = 10;
            dgvQuanLy.Columns["MaTTMuaVe"].DisplayIndex = 11;
            dgvQuanLy.Columns["MaKhachHang"].DisplayIndex = 12;
            dgvQuanLy.Columns["MaSuatChieu"].DisplayIndex = 13;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenKhachHang"].Visible = true;
            dgvQuanLy.Columns["CMND"].Visible = true;
            dgvQuanLy.Columns["HangGhe"].Visible = true;
            dgvQuanLy.Columns["DayGhe"].Visible = true;
            dgvQuanLy.Columns["GiaVe"].Visible = true;
            dgvQuanLy.Columns["GioiTinh"].Visible = true;
            dgvQuanLy.Columns["DiaChi"].Visible = true;
            dgvQuanLy.Columns["DienThoai"].Visible = true; ;
            dgvQuanLy.Columns["TenSuatChieu"].Visible = true;
            dgvQuanLy.Columns["MaTTMuaVe"].Visible = false;
            dgvQuanLy.Columns["MaVe"].Visible = true;
            dgvQuanLy.Columns["MaKhachHang"].Visible = false;
            dgvQuanLy.Columns["MaSuatChieu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenKhachHang"].Width = 120;
            dgvQuanLy.Columns["CMND"].Width = 100;
            dgvQuanLy.Columns["HangGhe"].Width = 60;
            dgvQuanLy.Columns["DayGhe"].Width = 60;
            dgvQuanLy.Columns["GiaVe"].Width = 100;
            dgvQuanLy.Columns["GioiTinh"].Width = 45;
            dgvQuanLy.Columns["DiaChi"].Width = 150;
            dgvQuanLy.Columns["DienThoai"].Width = 100; ;
            dgvQuanLy.Columns["TenSuatChieu"].Width = 120;
            dgvQuanLy.Columns["MaTTMuaVe"].Width = 45;
            dgvQuanLy.Columns["MaVe"].Width = 45;
            dgvQuanLy.Columns["MaKhachHang"].Width = 45;
            dgvQuanLy.Columns["MaSuatChieu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenKhachHang"].ReadOnly = true;
            dgvQuanLy.Columns["CMND"].ReadOnly = true;
            dgvQuanLy.Columns["HangGhe"].ReadOnly = true;
            dgvQuanLy.Columns["DayGhe"].ReadOnly = true;
            dgvQuanLy.Columns["GiaVe"].ReadOnly = true;
            dgvQuanLy.Columns["GioiTinh"].ReadOnly = true;
            dgvQuanLy.Columns["DiaChi"].ReadOnly = true;
            dgvQuanLy.Columns["DienThoai"].ReadOnly = true; ;
            dgvQuanLy.Columns["TenSuatChieu"].ReadOnly = true;
            dgvQuanLy.Columns["MaTTMuaVe"].ReadOnly = true;
            dgvQuanLy.Columns["MaVe"].ReadOnly = true;
            dgvQuanLy.Columns["MaKhachHang"].ReadOnly = true;
            dgvQuanLy.Columns["MaSuatChieu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_TTDatVe()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);
                
            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenDangNhap"].HeaderText = "Người đặt";
            dgvQuanLy.Columns["MaVe"].HeaderText = "Mã vé";
            dgvQuanLy.Columns["TenSuat"].HeaderText = "Suất";
            dgvQuanLy.Columns["TenPhim"].HeaderText = "Phim";
            dgvQuanLy.Columns["ThoiGianDat"].HeaderText = "Thời điểm đặt";
            dgvQuanLy.Columns["DonGia"].HeaderText = "Giá vé";
            dgvQuanLy.Columns["MaTaiKhoan"].HeaderText = "Mã TK";
            dgvQuanLy.Columns["MaTTDatve"].HeaderText = "Mã Đặt";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 4;
            dgvQuanLy.Columns["TenDangNhap"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaVe"].DisplayIndex = 2;
            dgvQuanLy.Columns["TenSuat"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenPhim"].DisplayIndex = 4;
            dgvQuanLy.Columns["ThoiGianDat"].DisplayIndex = 5;
            dgvQuanLy.Columns["DonGia"].DisplayIndex = 6;
            dgvQuanLy.Columns["MaTaiKhoan"].DisplayIndex = 7;
            dgvQuanLy.Columns["MaTTDatve"].DisplayIndex = 8;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenDangNhap"].Visible = true;
            dgvQuanLy.Columns["MaVe"].Visible = true;
            dgvQuanLy.Columns["TenSuat"].Visible = true;
            dgvQuanLy.Columns["TenPhim"].Visible = true;
            dgvQuanLy.Columns["ThoiGianDat"].Visible = true;
            dgvQuanLy.Columns["DonGia"].Visible = true;
            dgvQuanLy.Columns["MaTaiKhoan"].Visible = false;
            dgvQuanLy.Columns["MaTTDatve"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenDangNhap"].Width = 120;
            dgvQuanLy.Columns["MaVe"].Width = 80;
            dgvQuanLy.Columns["TenSuat"].Width = 120;
            dgvQuanLy.Columns["TenPhim"].Width = 120;
            dgvQuanLy.Columns["ThoiGianDat"].Width = 80;
            dgvQuanLy.Columns["DonGia"].Width = 80;
            dgvQuanLy.Columns["MaTaiKhoan"].Width = 45;
            dgvQuanLy.Columns["MaTTDatve"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenDangNhap"].ReadOnly = true;
            dgvQuanLy.Columns["MaVe"].ReadOnly = true;
            dgvQuanLy.Columns["TenSuat"].ReadOnly = true;
            dgvQuanLy.Columns["TenPhim"].ReadOnly = true;
            dgvQuanLy.Columns["ThoiGianDat"].ReadOnly = true;
            dgvQuanLy.Columns["DonGia"].ReadOnly = true;
            dgvQuanLy.Columns["MaTaiKhoan"].ReadOnly = true;
            dgvQuanLy.Columns["MaTTDatve"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_ChucVu()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenChucVu"].HeaderText = "Tên chức vụ";
            dgvQuanLy.Columns["MaChucVu"].HeaderText = "Mã chức vụ";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenChucVu"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaChucVu"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenChucVu"].Visible = true;
            dgvQuanLy.Columns["MaChucVu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenChucVu"].Width = 200;
            dgvQuanLy.Columns["MaChucVu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenChucVu"].ReadOnly = true;
            dgvQuanLy.Columns["MaChucVu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_TinhTrangPhongChieu()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].HeaderText = "Tình trạng";
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].HeaderText = "Mã tình trạng";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].Visible = true;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].Width = 200;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].ReadOnly = true;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_LoaiKyThuat()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenLoaiKyThuat"].HeaderText = "Loại kỹ thuật";
            dgvQuanLy.Columns["MaLoaiKyThuat"].HeaderText = "Mã kỹ thuật";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenLoaiKyThuat"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaLoaiKyThuat"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenLoaiKyThuat"].Visible = true;
            dgvQuanLy.Columns["MaLoaiKyThuat"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenLoaiKyThuat"].Width = 200;
            dgvQuanLy.Columns["MaLoaiKyThuat"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenLoaiKyThuat"].ReadOnly = true;
            dgvQuanLy.Columns["MaLoaiKyThuat"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_DienVien()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenDienVien"].HeaderText = "Tên diễn viên";
            dgvQuanLy.Columns["MaDienVien"].HeaderText = "Mã diễn viên";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenDienVien"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaDienVien"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenDienVien"].Visible = true;
            dgvQuanLy.Columns["MaDienVien"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenDienVien"].Width = 200;
            dgvQuanLy.Columns["MaDienVien"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenDienVien"].ReadOnly = true;
            dgvQuanLy.Columns["MaDienVien"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_TheLoaiPhim()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenTheLoaiPhim"].HeaderText = "Thể loại phim";
            dgvQuanLy.Columns["MaTheLoaiPhim"].HeaderText = "Mã thể loại";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenTheLoaiPhim"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaTheLoaiPhim"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenTheLoaiPhim"].Visible = true;
            dgvQuanLy.Columns["MaTheLoaiPhim"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenTheLoaiPhim"].Width = 200;
            dgvQuanLy.Columns["MaTheLoaiPhim"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenTheLoaiPhim"].ReadOnly = true;
            dgvQuanLy.Columns["MaTheLoaiPhim"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_TrangThaiPhim()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenTrangThaiPhim"].HeaderText = "Trạng thái";
            dgvQuanLy.Columns["MaTrangThaiPhim"].HeaderText = "Mã trạng thái";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenTrangThaiPhim"].DisplayIndex = 1;
            dgvQuanLy.Columns["MaTrangThaiPhim"].DisplayIndex = 2;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenTrangThaiPhim"].Visible = true;
            dgvQuanLy.Columns["MaTrangThaiPhim"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenTrangThaiPhim"].Width = 200;
            dgvQuanLy.Columns["MaTrangThaiPhim"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenTrangThaiPhim"].ReadOnly = true;
            dgvQuanLy.Columns["MaTrangThaiPhim"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_Rap()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenRap"].HeaderText = "Tên rạp";
            dgvQuanLy.Columns["DiaChi"].HeaderText = "Địa chỉ";
            dgvQuanLy.Columns["MaRap"].HeaderText = "Mã rạp";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 4;
            dgvQuanLy.Columns["TenRap"].DisplayIndex = 1;
            dgvQuanLy.Columns["DiaChi"].DisplayIndex = 2;
            dgvQuanLy.Columns["MaRap"].DisplayIndex = 3;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenRap"].Visible = true;
            dgvQuanLy.Columns["DiaChi"].Visible = true;
            dgvQuanLy.Columns["MaRap"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenRap"].Width = 200;
            dgvQuanLy.Columns["DiaChi"].Width = 200;
            dgvQuanLy.Columns["MaRap"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenRap"].ReadOnly = true;
            dgvQuanLy.Columns["DiaChi"].ReadOnly = true;
            dgvQuanLy.Columns["MaRap"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_PhongChieu()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenRap"].HeaderText = "Tên rạp";
            dgvQuanLy.Columns["TenPhongChieu"].HeaderText = "Tên phòng chiếu";
            dgvQuanLy.Columns["MoTa"].HeaderText = "Mô tả";
            dgvQuanLy.Columns["SoDayGhe"].HeaderText = "Số dãy";
            dgvQuanLy.Columns["SoHangGhe"].HeaderText = "Số hàng";
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].HeaderText = "Tình trạng";
            dgvQuanLy.Columns["TenLoaiKyThuat"].HeaderText = "Kĩ thuật";
            dgvQuanLy.Columns["MaLoaiKyThuat"].HeaderText = "Mã kĩ thuất";
            dgvQuanLy.Columns["MaPhongChieu"].HeaderText = "Mã phòng chiếu";
            dgvQuanLy.Columns["MaRap"].HeaderText = "Mã rạp";
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].HeaderText = "Mã tình trạng";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 12;
            dgvQuanLy.Columns["TenPhongChieu"].DisplayIndex = 1;
            dgvQuanLy.Columns["TenRap"].DisplayIndex = 2;
            dgvQuanLy.Columns["MoTa"].DisplayIndex = 3;
            dgvQuanLy.Columns["SoDayGhe"].DisplayIndex = 4;
            dgvQuanLy.Columns["SoHangGhe"].DisplayIndex = 5;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].DisplayIndex = 6;
            dgvQuanLy.Columns["TenLoaiKyThuat"].DisplayIndex = 7;
            dgvQuanLy.Columns["MaLoaiKyThuat"].DisplayIndex = 8;
            dgvQuanLy.Columns["MaPhongChieu"].DisplayIndex = 9;
            dgvQuanLy.Columns["MaRap"].DisplayIndex = 10;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].DisplayIndex = 11;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenPhongChieu"].Visible = true;
            dgvQuanLy.Columns["TenRap"].Visible = true;
            dgvQuanLy.Columns["MoTa"].Visible = true;
            dgvQuanLy.Columns["SoDayGhe"].Visible = true;
            dgvQuanLy.Columns["SoHangGhe"].Visible = true;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].Visible = true;
            dgvQuanLy.Columns["TenLoaiKyThuat"].Visible = true;
            dgvQuanLy.Columns["MaLoaiKyThuat"].Visible = false;
            dgvQuanLy.Columns["MaPhongChieu"].Visible = false;
            dgvQuanLy.Columns["MaRap"].Visible = false;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenPhongChieu"].Width = 200;
            dgvQuanLy.Columns["TenRap"].Width = 200;
            dgvQuanLy.Columns["MoTa"].Width = 200;
            dgvQuanLy.Columns["SoDayGhe"].Width = 100;
            dgvQuanLy.Columns["SoHangGhe"].Width = 100;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].Width = 120;
            dgvQuanLy.Columns["TenLoaiKyThuat"].Width = 120;
            dgvQuanLy.Columns["MaLoaiKyThuat"].Width = 45;
            dgvQuanLy.Columns["MaPhongChieu"].Width = 45;
            dgvQuanLy.Columns["MaRap"].Width = 45;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenPhongChieu"].ReadOnly = true;
            dgvQuanLy.Columns["TenRap"].ReadOnly = true;
            dgvQuanLy.Columns["MoTa"].ReadOnly = true;
            dgvQuanLy.Columns["SoDayGhe"].ReadOnly = true;
            dgvQuanLy.Columns["SoHangGhe"].ReadOnly = true;
            dgvQuanLy.Columns["TenTinhTrangPhongChieu"].ReadOnly = true;
            dgvQuanLy.Columns["TenLoaiKyThuat"].ReadOnly = true;
            dgvQuanLy.Columns["MaLoaiKyThuat"].ReadOnly = true;
            dgvQuanLy.Columns["MaPhongChieu"].ReadOnly = true;
            dgvQuanLy.Columns["MaRap"].ReadOnly = true;
            dgvQuanLy.Columns["MaTinhTrangPhongChieu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_Phim()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["NamSanXuat"].HeaderText = "Năm sản xuất";
            dgvQuanLy.Columns["TenPhim"].HeaderText = "Tên phim";
            dgvQuanLy.Columns["GioiThieuPhim"].HeaderText = "Giới thiệu";
            dgvQuanLy.Columns["HangSanXuat"].HeaderText = "Hãng sản xuất";
            dgvQuanLy.Columns["TenDinhDangPhim"].HeaderText = "Định dạng";
            dgvQuanLy.Columns["TenTrangThaiPhim"].HeaderText = "Trạng thái";
            dgvQuanLy.Columns["ThoiLuongPhim"].HeaderText = "Thời lượng";
            dgvQuanLy.Columns["Trailer"].HeaderText = "Trailer";
            dgvQuanLy.Columns["Poster"].HeaderText = "Poster";
            dgvQuanLy.Columns["MaDinhDangPhim"].HeaderText = "Mã định dạng";
            dgvQuanLy.Columns["MaPhim"].HeaderText = "Mã phim";
            dgvQuanLy.Columns["MaTrangThaiPhim"].HeaderText = "Mã trạng thái";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 13;
            dgvQuanLy.Columns["NamSanXuat"].DisplayIndex = 1;
            dgvQuanLy.Columns["TenPhim"].DisplayIndex = 2;
            dgvQuanLy.Columns["GioiThieuPhim"].DisplayIndex = 3;
            dgvQuanLy.Columns["HangSanXuat"].DisplayIndex = 4;
            dgvQuanLy.Columns["TenDinhDangPhim"].DisplayIndex = 5;
            dgvQuanLy.Columns["TenTrangThaiPhim"].DisplayIndex = 6;
            dgvQuanLy.Columns["ThoiLuongPhim"].DisplayIndex = 7;
            dgvQuanLy.Columns["Trailer"].DisplayIndex = 8;
            dgvQuanLy.Columns["Poster"].DisplayIndex = 9;
            dgvQuanLy.Columns["MaDinhDangPhim"].DisplayIndex = 10;
            dgvQuanLy.Columns["MaPhim"].DisplayIndex = 11;
            dgvQuanLy.Columns["MaTrangThaiPhim"].DisplayIndex = 12;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["NamSanXuat"].Visible = true;
            dgvQuanLy.Columns["TenPhim"].Visible = true;
            dgvQuanLy.Columns["GioiThieuPhim"].Visible = true;
            dgvQuanLy.Columns["HangSanXuat"].Visible = true;
            dgvQuanLy.Columns["TenDinhDangPhim"].Visible = true;
            dgvQuanLy.Columns["TenTrangThaiPhim"].Visible = true;
            dgvQuanLy.Columns["ThoiLuongPhim"].Visible = true;
            dgvQuanLy.Columns["Trailer"].Visible = true;
            dgvQuanLy.Columns["Poster"].Visible = true;
            dgvQuanLy.Columns["MaDinhDangPhim"].Visible = false;
            dgvQuanLy.Columns["MaPhim"].Visible = false;
            dgvQuanLy.Columns["MaTrangThaiPhim"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["NamSanXuat"].Width = 80;
            dgvQuanLy.Columns["TenPhim"].Width = 200;
            dgvQuanLy.Columns["GioiThieuPhim"].Width = 200;
            dgvQuanLy.Columns["HangSanXuat"].Width = 100;
            dgvQuanLy.Columns["TenDinhDangPhim"].Width = 145;
            dgvQuanLy.Columns["TenTrangThaiPhim"].Width = 145;
            dgvQuanLy.Columns["ThoiLuongPhim"].Width = 100;
            dgvQuanLy.Columns["Trailer"].Width = 100;
            dgvQuanLy.Columns["Poster"].Width = 100;
            dgvQuanLy.Columns["MaDinhDangPhim"].Width = 45;
            dgvQuanLy.Columns["MaPhim"].Width = 45;
            dgvQuanLy.Columns["MaTrangThaiPhim"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["NamSanXuat"].ReadOnly = true;
            dgvQuanLy.Columns["TenPhim"].ReadOnly = true;
            dgvQuanLy.Columns["GioiThieuPhim"].ReadOnly = true;
            dgvQuanLy.Columns["HangSanXuat"].ReadOnly = true;
            dgvQuanLy.Columns["TenDinhDangPhim"].ReadOnly = true;
            dgvQuanLy.Columns["TenTrangThaiPhim"].ReadOnly = true;
            dgvQuanLy.Columns["ThoiLuongPhim"].ReadOnly = true;
            dgvQuanLy.Columns["Trailer"].ReadOnly = true;
            dgvQuanLy.Columns["Poster"].ReadOnly = true;
            dgvQuanLy.Columns["MaDinhDangPhim"].ReadOnly = true;
            dgvQuanLy.Columns["MaPhim"].ReadOnly = true;
            dgvQuanLy.Columns["MaTrangThaiPhim"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_CaChieu()
        {

            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenCaChieu"].HeaderText = "Ca chiếu";
            dgvQuanLy.Columns["ThoiGianBatDau"].HeaderText = "Thời gian bắt đầu";
            dgvQuanLy.Columns["ThoiGianKetThuc"].HeaderText = "Thời gian kết thúc";
            dgvQuanLy.Columns["MaCaChieu"].HeaderText = "Mã ca chiếu";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 5;
            dgvQuanLy.Columns["TenCaChieu"].DisplayIndex = 1;
            dgvQuanLy.Columns["ThoiGianBatDau"].DisplayIndex = 2;
            dgvQuanLy.Columns["ThoiGianKetThuc"].DisplayIndex = 3;
            dgvQuanLy.Columns["MaCaChieu"].DisplayIndex = 4;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenCaChieu"].Visible = true;
            dgvQuanLy.Columns["ThoiGianBatDau"].Visible = true; ;
            dgvQuanLy.Columns["ThoiGianKetThuc"].Visible = true;
            dgvQuanLy.Columns["MaCaChieu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenCaChieu"].Width = 200;
            dgvQuanLy.Columns["ThoiGianBatDau"].Width = 100;
            dgvQuanLy.Columns["ThoiGianKetThuc"].Width = 100;
            dgvQuanLy.Columns["MaCaChieu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenCaChieu"].ReadOnly = true;
            dgvQuanLy.Columns["ThoiGianBatDau"].ReadOnly = true;
            dgvQuanLy.Columns["ThoiGianKetThuc"].ReadOnly = true;
            dgvQuanLy.Columns["MaCaChieu"].ReadOnly = true; ;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_SuatChieu()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenSuatChieu"].HeaderText = "Suất chiếu";
            dgvQuanLy.Columns["SoLuongVe"].HeaderText = "Số lượng vé";
            dgvQuanLy.Columns["TenPhim"].HeaderText = "Tên phim";
            dgvQuanLy.Columns["TenCaChieu"].HeaderText = "Ca chiếu";
            dgvQuanLy.Columns["MaSuatChieu"].HeaderText = "Mã suất";
            dgvQuanLy.Columns["MaCaChieu"].HeaderText = "Mã ca";
            dgvQuanLy.Columns["MaPhim"].HeaderText = "Mã phim";
            dgvQuanLy.Columns["MaPhongChieu"].HeaderText = "Mã phòng";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 9;
            dgvQuanLy.Columns["TenSuatChieu"].DisplayIndex = 1;
            dgvQuanLy.Columns["SoLuongVe"].DisplayIndex = 2;
            dgvQuanLy.Columns["TenPhim"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenCaChieu"].DisplayIndex = 4;
            dgvQuanLy.Columns["MaSuatChieu"].DisplayIndex = 5;
            dgvQuanLy.Columns["MaCaChieu"].DisplayIndex = 6;
            dgvQuanLy.Columns["MaPhim"].DisplayIndex = 7;
            dgvQuanLy.Columns["MaPhongChieu"].DisplayIndex = 8;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenSuatChieu"].Visible = true;
            dgvQuanLy.Columns["SoLuongVe"].Visible = true;
            dgvQuanLy.Columns["TenPhim"].Visible = true;
            dgvQuanLy.Columns["TenCaChieu"].Visible = true;
            dgvQuanLy.Columns["MaSuatChieu"].Visible = true;
            dgvQuanLy.Columns["MaCaChieu"].Visible = false;
            dgvQuanLy.Columns["MaPhim"].Visible = false;
            dgvQuanLy.Columns["MaPhongChieu"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenSuatChieu"].Width = 145;
            dgvQuanLy.Columns["SoLuongVe"].Width = 100;
            dgvQuanLy.Columns["TenPhim"].Width = 145;
            dgvQuanLy.Columns["TenCaChieu"].Width = 145;
            dgvQuanLy.Columns["MaSuatChieu"].Width = 45;
            dgvQuanLy.Columns["MaCaChieu"].Width = 45;
            dgvQuanLy.Columns["MaPhim"].Width = 45;
            dgvQuanLy.Columns["MaPhongChieu"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenSuatChieu"].ReadOnly = true;
            dgvQuanLy.Columns["SoLuongVe"].ReadOnly = true;
            dgvQuanLy.Columns["TenPhim"].ReadOnly = true;
            dgvQuanLy.Columns["TenCaChieu"].ReadOnly = true; ;
            dgvQuanLy.Columns["MaSuatChieu"].ReadOnly = true; ;
            dgvQuanLy.Columns["MaCaChieu"].ReadOnly = true;
            dgvQuanLy.Columns["MaPhim"].ReadOnly = true;
            dgvQuanLy.Columns["MaPhongChieu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_VeXemPhim()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["DayGhe"].HeaderText = "Dãy ghế";
            dgvQuanLy.Columns["GiaVe"].HeaderText = "Giá vé";
            dgvQuanLy.Columns["HangGhe"].HeaderText = "Hàng ghế";
            dgvQuanLy.Columns["MaSuatChieu"].HeaderText = "Mã suất";
            dgvQuanLy.Columns["MaVe"].HeaderText = "Mã vé";
            dgvQuanLy.Columns["TenSuatChieu"].HeaderText = "Suất chiếu";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["TenSuatChieu"].DisplayIndex = 1;
            dgvQuanLy.Columns["DayGhe"].DisplayIndex = 2;
            dgvQuanLy.Columns["HangGhe"].DisplayIndex = 3;
            dgvQuanLy.Columns["GiaVe"].DisplayIndex = 4;
            dgvQuanLy.Columns["MaSuatChieu"].DisplayIndex = 5;
            dgvQuanLy.Columns["MaVe"].DisplayIndex = 6;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 7;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["DayGhe"].Visible = true;
            dgvQuanLy.Columns["GiaVe"].Visible = true;
            dgvQuanLy.Columns["HangGhe"].Visible = true;
            dgvQuanLy.Columns["MaSuatChieu"].Visible = true;
            dgvQuanLy.Columns["MaVe"].Visible = true;
            dgvQuanLy.Columns["TenSuatChieu"].Visible = true;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["DayGhe"].Width = 80;
            dgvQuanLy.Columns["GiaVe"].Width = 100;
            dgvQuanLy.Columns["HangGhe"].Width = 80;
            dgvQuanLy.Columns["MaSuatChieu"].Width = 45;
            dgvQuanLy.Columns["MaVe"].Width = 45;
            dgvQuanLy.Columns["TenSuatChieu"].Width = 100;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["DayGhe"].ReadOnly = true;
            dgvQuanLy.Columns["GiaVe"].ReadOnly = true;
            dgvQuanLy.Columns["HangGhe"].ReadOnly = true;
            dgvQuanLy.Columns["MaSuatChieu"].ReadOnly = true;
            dgvQuanLy.Columns["MaVe"].ReadOnly = true;
            dgvQuanLy.Columns["TenSuatChieu"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }

        private void Setup_dgv_TaiKhoan()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["HoTenNguoiDung"].HeaderText = "Họ tên";
            dgvQuanLy.Columns["MaKhachHang"].HeaderText = "Mã KH";
            dgvQuanLy.Columns["MaLoaiTaiKhoan"].HeaderText = "Mã Chức vụ";
            dgvQuanLy.Columns["MaNhanVien"].HeaderText = "Mã NV";
            dgvQuanLy.Columns["MaTaiKhoan"].HeaderText = "Số TK";
            dgvQuanLy.Columns["MatKhau"].HeaderText = "Mật khẩu";
            dgvQuanLy.Columns["TenDangNhap"].HeaderText = "Tên đăng nhập";
            dgvQuanLy.Columns["TenLoaiTaiKhoan"].HeaderText = "Chức vụ";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["TenDangNhap"].DisplayIndex = 1;
            dgvQuanLy.Columns["MatKhau"].DisplayIndex = 2;
            dgvQuanLy.Columns["HoTenNguoiDung"].DisplayIndex = 3;
            dgvQuanLy.Columns["TenLoaiTaiKhoan"].DisplayIndex = 4;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 5;
            dgvQuanLy.Columns["MaKhachHang"].DisplayIndex = 6;
            dgvQuanLy.Columns["MaLoaiTaiKhoan"].DisplayIndex = 7;
            dgvQuanLy.Columns["MaNhanVien"].DisplayIndex = 8;
            dgvQuanLy.Columns["MaTaiKhoan"].DisplayIndex = 9;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["HoTenNguoiDung"].Visible = true;
            dgvQuanLy.Columns["MaKhachHang"].Visible = false;
            dgvQuanLy.Columns["MaLoaiTaiKhoan"].Visible = false;
            dgvQuanLy.Columns["MaNhanVien"].Visible = false;
            dgvQuanLy.Columns["MaTaiKhoan"].Visible = false;
            dgvQuanLy.Columns["MatKhau"].Visible = true;
            dgvQuanLy.Columns["TenDangNhap"].Visible = true;
            dgvQuanLy.Columns["TenLoaiTaiKhoan"].Visible = true;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["HoTenNguoiDung"].Width = 200;
            dgvQuanLy.Columns["MaKhachHang"].Width = 45;
            dgvQuanLy.Columns["MaLoaiTaiKhoan"].Width = 45;
            dgvQuanLy.Columns["MaNhanVien"].Width = 45;
            dgvQuanLy.Columns["MaTaiKhoan"].Width = 45;
            dgvQuanLy.Columns["MatKhau"].Width = 100;
            dgvQuanLy.Columns["TenDangNhap"].Width = 200;
            dgvQuanLy.Columns["TenLoaiTaiKhoan"].Width = 200;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["HoTenNguoiDung"].ReadOnly = true;
            dgvQuanLy.Columns["MaKhachHang"].ReadOnly = true;
            dgvQuanLy.Columns["MaLoaiTaiKhoan"].ReadOnly = true;
            dgvQuanLy.Columns["MaNhanVien"].ReadOnly = true;
            dgvQuanLy.Columns["MaTaiKhoan"].ReadOnly = true;
            dgvQuanLy.Columns["MatKhau"].ReadOnly = true;
            dgvQuanLy.Columns["TenDangNhap"].ReadOnly = true;
            dgvQuanLy.Columns["TenLoaiTaiKhoan"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl);
        }
        
        private void Setup_dgv_TTNhanVien()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenNhanVien"].HeaderText = "Họ tên";
            dgvQuanLy.Columns["CMND"].HeaderText = "CMND";
            dgvQuanLy.Columns["NgaySinh"].HeaderText = "Ngày sinh";
            dgvQuanLy.Columns["GioiTinh"].HeaderText = "Giới tính";
            dgvQuanLy.Columns["DiaChi"].HeaderText = "Địa chỉ";
            dgvQuanLy.Columns["DienThoai"].HeaderText = "Điện thoại";
            dgvQuanLy.Columns["TenChucVu"].HeaderText = "Chức vụ";
            dgvQuanLy.Columns["MaChucVu"].HeaderText = "Mã CV";
            dgvQuanLy.Columns["MaNhanVien"].HeaderText = "Mã NV";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 10;
            dgvQuanLy.Columns["TenNhanVien"].DisplayIndex = 1;
            dgvQuanLy.Columns["CMND"].DisplayIndex = 2;
            dgvQuanLy.Columns["NgaySinh"].DisplayIndex = 3;
            dgvQuanLy.Columns["GioiTinh"].DisplayIndex = 4;
            dgvQuanLy.Columns["DiaChi"].DisplayIndex = 5;
            dgvQuanLy.Columns["DienThoai"].DisplayIndex = 6;
            dgvQuanLy.Columns["TenChucVu"].DisplayIndex = 7;
            dgvQuanLy.Columns["MaChucVu"].DisplayIndex = 8;
            dgvQuanLy.Columns["MaNhanVien"].DisplayIndex = 9;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenNhanVien"].Visible = true;
            dgvQuanLy.Columns["CMND"].Visible = true;
            dgvQuanLy.Columns["NgaySinh"].Visible = true;
            dgvQuanLy.Columns["GioiTinh"].Visible = true;
            dgvQuanLy.Columns["DiaChi"].Visible = true;
            dgvQuanLy.Columns["DienThoai"].Visible = true;
            dgvQuanLy.Columns["TenChucVu"].Visible = true;
            dgvQuanLy.Columns["MaChucVu"].Visible = false;
            dgvQuanLy.Columns["MaNhanVien"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenNhanVien"].Width = 120;
            dgvQuanLy.Columns["CMND"].Width = 100;
            dgvQuanLy.Columns["NgaySinh"].Width = 80;
            dgvQuanLy.Columns["GioiTinh"].Width = 45;
            dgvQuanLy.Columns["DiaChi"].Width = 120;
            dgvQuanLy.Columns["DienThoai"].Width = 100;
            dgvQuanLy.Columns["TenChucVu"].Width = 100;
            dgvQuanLy.Columns["MaChucVu"].Width = 45;
            dgvQuanLy.Columns["MaNhanVien"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenNhanVien"].ReadOnly = true;
            dgvQuanLy.Columns["CMND"].ReadOnly = true;
            dgvQuanLy.Columns["NgaySinh"].ReadOnly = true;
            dgvQuanLy.Columns["GioiTinh"].ReadOnly = true;
            dgvQuanLy.Columns["DiaChi"].ReadOnly = true;
            dgvQuanLy.Columns["DienThoai"].ReadOnly = true;
            dgvQuanLy.Columns["TenChucVu"].ReadOnly = true;
            dgvQuanLy.Columns["MaChucVu"].ReadOnly = true;
            dgvQuanLy.Columns["MaNhanVien"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl1);

            DataGridViewTextBoxColumn cl1 = new DataGridViewTextBoxColumn();
            cl1.HeaderText = "Giới tính";
            cl1.Name = "GioiTinh1";
            cl1.Width = 35;
            cl1.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl1);
        }
        
        private void Setup_dgv_TTKhachHang()
        {
            // Đặt tên các cột ;
            DataGridViewCheckBoxColumn clChon = new DataGridViewCheckBoxColumn();
            clChon.Name = "Chon";
            clChon.TrueValue = "Yes";
            clChon.FalseValue = "No";
            dgvQuanLy.Columns.Insert(0, clChon);

            dgvQuanLy.Columns["Chon"].HeaderText = "Chọn";
            dgvQuanLy.Columns["DaXoa"].HeaderText = "Đã xóa";
            dgvQuanLy.Columns["TenKhachHang"].HeaderText = "Họ tên";
            dgvQuanLy.Columns["CMND"].HeaderText = "CMND";
            dgvQuanLy.Columns["NgaySinh"].HeaderText = "Ngày sinh";
            dgvQuanLy.Columns["GioiTinh"].HeaderText = "Giới tính";
            dgvQuanLy.Columns["DienThoai"].HeaderText = "Điện thoại";
            dgvQuanLy.Columns["DiaChi"].HeaderText = "Địa chỉ";
            dgvQuanLy.Columns["MaKhachHang"].HeaderText = "Mã NV";

            dgvQuanLy.Columns["Chon"].DisplayIndex = 0;
            dgvQuanLy.Columns["DaXoa"].DisplayIndex = 8;
            dgvQuanLy.Columns["TenKhachHang"].DisplayIndex = 1;
            dgvQuanLy.Columns["CMND"].DisplayIndex = 2;
            dgvQuanLy.Columns["NgaySinh"].DisplayIndex = 3;
            dgvQuanLy.Columns["GioiTinh"].DisplayIndex = 4;
            dgvQuanLy.Columns["DiaChi"].DisplayIndex = 5;
            dgvQuanLy.Columns["DienThoai"].DisplayIndex = 6;
            dgvQuanLy.Columns["MaKhachHang"].DisplayIndex = 7;

            dgvQuanLy.Columns["Chon"].Visible = true;
            dgvQuanLy.Columns["DaXoa"].Visible = false;
            dgvQuanLy.Columns["TenKhachHang"].Visible = true;
            dgvQuanLy.Columns["CMND"].Visible = true;
            dgvQuanLy.Columns["NgaySinh"].Visible = true;
            dgvQuanLy.Columns["GioiTinh"].Visible = true;
            dgvQuanLy.Columns["DiaChi"].Visible = true;
            dgvQuanLy.Columns["DienThoai"].Visible = true;
            dgvQuanLy.Columns["MaKhachHang"].Visible = false;

            dgvQuanLy.Columns["Chon"].Width = 45;
            dgvQuanLy.Columns["DaXoa"].Width = 45;
            dgvQuanLy.Columns["TenKhachHang"].Width = 120;
            dgvQuanLy.Columns["CMND"].Width = 100;
            dgvQuanLy.Columns["NgaySinh"].Width = 80;
            dgvQuanLy.Columns["GioiTinh"].Width = 45;
            dgvQuanLy.Columns["DiaChi"].Width = 120;
            dgvQuanLy.Columns["DienThoai"].Width = 100;
            dgvQuanLy.Columns["MaKhachHang"].Width = 45;

            dgvQuanLy.Columns["Chon"].ReadOnly = false;
            dgvQuanLy.Columns["DaXoa"].ReadOnly = true;
            dgvQuanLy.Columns["TenKhachHang"].ReadOnly = true;
            dgvQuanLy.Columns["CMND"].ReadOnly = true;
            dgvQuanLy.Columns["NgaySinh"].ReadOnly = true;
            dgvQuanLy.Columns["GioiTinh"].ReadOnly = true;
            dgvQuanLy.Columns["DiaChi"].ReadOnly = true;
            dgvQuanLy.Columns["DienThoai"].ReadOnly = true;
            dgvQuanLy.Columns["MaKhachHang"].ReadOnly = true;

            DataGridViewTextBoxColumn cl = new DataGridViewTextBoxColumn();
            cl.HeaderText = "STT";
            cl.Name = "STT";
            cl.Width = 35;
            cl.ReadOnly = true;
            //dgvQuanLy.Columns.Insert(0, cl1);
        }

        private void LoadDanhSach()
        {
            dgvQuanLy.Columns.Clear();
            btnBoXoa.Enabled = false;
            btnXoa.Enabled = true;
            btnDanhSachDaXoa.Enabled = true;
            switch (Tag.ToString())
            {
                case "Rap":
                    RapBUS BUS_Rap = new RapBUS();
                    BindingList<RapDTO> DanhSach_Rap = BUS_Rap.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_Rap;
                    break;
                case "PhongChieu":
                    PhongChieuBUS BUS_PhongChieu = new PhongChieuBUS();
                    BindingList<PhongChieuDTO> DanhSach_PhongChieu = BUS_PhongChieu.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_PhongChieu;
                    break;
                case "Phim":
                    PhimBUS BUS_Phim = new PhimBUS();
                    BindingList<PhimDTO> DanhSach_Phim = BUS_Phim.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_Phim;
                    break;
                case "CaChieu":
                    CaChieuBUS BUS_CaChieu = new CaChieuBUS();
                    BindingList<CaChieuDTO> DanhSach_CaChieu = BUS_CaChieu.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_CaChieu;
                    break;
                case "SuatChieu":
                    SuatChieuBUS BUS_SuatChieu = new SuatChieuBUS();
                    BindingList<SuatChieuDTO> DanhSach_SuatChieu = BUS_SuatChieu.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_SuatChieu;
                    break;
                case "VeXemPhim":
                    VeBUS BUS_Ve = new VeBUS();
                    BindingList<VeDTO> DanhSach_Ve = BUS_Ve.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_Ve;
                    break;
                case "NhanVien":
                    TaiKhoanBUS BUS_NhanVien = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_NhanVien = BUS_NhanVien.GetList_QLNhanVien();
                    dgvQuanLy.DataSource = DanhSach_NhanVien;
                    break;
                case "KhachHang":
                    TaiKhoanBUS BUS_KhachHang = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_KhachHang = BUS_KhachHang.GetList_QLKhachHang();
                    dgvQuanLy.DataSource = DanhSach_KhachHang;
                    break;
                case "TTNhanVien":
                    NhanVienBUS NhanVienBUS = new NhanVienBUS();
                    BindingList<NhanVienDTO> DanhSach_TTNhanVien = NhanVienBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TTNhanVien;
                    break;
                case "TTKhachHang":
                    KhachHangBUS KhachHangBUS = new KhachHangBUS();
                    BindingList<KhachHangDTO> DanhSach_TTKhachHang = KhachHangBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TTKhachHang;
                    break;
                case "TTDatVe":
                    TTDatVeBUS BUS_TTDatVe = new TTDatVeBUS();
                    BindingList<TTDatVeDTO> DanhSach_TTDatVe = BUS_TTDatVe.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TTDatVe;
                    break;
                case "ChucVu":
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    BindingList<ChucVuDTO> DanhSach_ChucVu = ChucVuBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_ChucVu;
                    break;
                case "TrangThaiPhim":
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    BindingList<TrangThaiPhimDTO> DanhSach_TrangThaiPhim = TrangThaiPhimBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TrangThaiPhim;
                    break;
                case "TheLoaiPhim":
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    BindingList<TheLoaiPhimDTO> DanhSach_TheLoaiPhim = TheLoaiPhimBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TheLoaiPhim;
                    break;
                case "DienVien":
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    BindingList<DienVienDTO> DanhSach_DienVien = DienVienBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_DienVien;
                    break;
                case "LoaiKyThuat":
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    BindingList<LoaiKyThuatDTO> DanhSach_LoaiKyThuat = LoaiKyThuatBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_LoaiKyThuat;
                    break;
                case "TinhTrangPhongChieu":
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    BindingList<TinhTrangPhongChieuDTO> DanhSach_TinhTrangPhongChieu = TinhTrangPhongChieuBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TinhTrangPhongChieu;
                    break;
                case "TTMuaVe":
                    btnBoXoa.Enabled = false;
                    btnXoa.Enabled = false;
                    btnDanhSachDaXoa.Enabled = false;
                    TTMuaVeBUS TTMuaVeBUS = new TTMuaVeBUS();
                    BindingList<TTMuaVeDTO> DanhSach_TTMuaVe = TTMuaVeBUS.GetList_QL();
                    dgvQuanLy.DataSource = DanhSach_TTMuaVe;
                    break;
                default:
                    break;
            }
        }

        private void LoadDanhSach_DaXoa()
        {
            btnBoXoa.Enabled = true;
            btnXoa.Enabled = true;
            dgvQuanLy.Columns.Clear();
            switch (Tag.ToString())
            {
                case "Rap":
                    RapBUS BUS_Rap = new RapBUS();
                    BindingList<RapDTO> DanhSach_Rap = BUS_Rap.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_Rap;
                    break;
                case "PhongChieu":
                    PhongChieuBUS BUS_PhongChieu = new PhongChieuBUS();
                    BindingList<PhongChieuDTO> DanhSach_PhongChieu = BUS_PhongChieu.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_PhongChieu;
                    break;
                case "Phim":
                    PhimBUS BUS_Phim = new PhimBUS();
                    BindingList<PhimDTO> DanhSach_Phim = BUS_Phim.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_Phim;
                    break;
                case "CaChieu":
                    CaChieuBUS BUS_CaChieu = new CaChieuBUS();
                    BindingList<CaChieuDTO> DanhSach_CaChieu = BUS_CaChieu.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_CaChieu;
                    break;
                case "SuatChieu":
                    btnBoXoa.Enabled = false;
                    SuatChieuBUS BUS_SuatChieu = new SuatChieuBUS();
                    BindingList<SuatChieuDTO> DanhSach_SuatChieu = BUS_SuatChieu.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_SuatChieu;
                    break;
                case "VeXemPhim":
                    VeBUS BUS_Ve = new VeBUS();
                    BindingList<VeDTO> DanhSach_Ve = BUS_Ve.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_Ve;
                    break;
                case "NhanVien":
                    TaiKhoanBUS BUS_NhanVien = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_NhanVien = BUS_NhanVien.GetList_QLNhanVien_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_NhanVien;
                    break;
                case "KhachHang":
                    TaiKhoanBUS BUS_KhachHang = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_KhachHang = BUS_KhachHang.GetList_QLKhachHang_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_KhachHang;
                    break;
                case "TTNhanVien":
                    NhanVienBUS NhanVienBUS = new NhanVienBUS();
                    BindingList<NhanVienDTO> DanhSach_TTNhanVien = NhanVienBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TTNhanVien;
                    break;
                case "TTKhachHang":
                    KhachHangBUS KhachHangBUS = new KhachHangBUS();
                    BindingList<KhachHangDTO> DanhSach_TTKhachHang = KhachHangBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TTKhachHang;
                    break;
                case "ChucVu":
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    BindingList<ChucVuDTO> DanhSach_ChucVu = ChucVuBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_ChucVu;
                    break;
                case "TrangThaiPhim":
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    BindingList<TrangThaiPhimDTO> DanhSach_TrangThaiPhim = TrangThaiPhimBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TrangThaiPhim;
                    break;
                case "TheLoaiPhim":
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    BindingList<TheLoaiPhimDTO> DanhSach_TheLoaiPhim = TheLoaiPhimBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TheLoaiPhim;
                    break;
                case "DienVien":
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    BindingList<DienVienDTO> DanhSach_DienVien = DienVienBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_DienVien;
                    break;
                case "LoaiKyThuat":
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    BindingList<LoaiKyThuatDTO> DanhSach_LoaiKyThuat = LoaiKyThuatBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_LoaiKyThuat;
                    break;
                case "TinhTrangPhongChieu":
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    BindingList<TinhTrangPhongChieuDTO> DanhSach_TinhTrangPhongChieu = TinhTrangPhongChieuBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TinhTrangPhongChieu;
                    break;
                case "TTMuaVe":
                    btnBoXoa.Enabled = true;
                    TTMuaVeBUS TTMuaVeBUS = new TTMuaVeBUS();
                    BindingList<TTMuaVeDTO> DanhSach_TTMuaVe = TTMuaVeBUS.GetList_QL_DaXoa();
                    dgvQuanLy.DataSource = DanhSach_TTMuaVe;
                    break;
                default:
                    break;
            }
        }

        private void Setup_dgv()
        {
            dgvQuanLy.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy;
            dgvQuanLy.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            dgvQuanLy.ColumnHeadersDefaultCellStyle.Font = new Font(dgvQuanLy.Font, FontStyle.Bold);
            dgvQuanLy.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvQuanLy.GridColor = Color.DarkGray;     // Màu các của lưới 
            dgvQuanLy.BackgroundColor = Color.White;   // Màu nền gridview 
            dgvQuanLy.ForeColor = Color.Blue;          // Màu chữ 

            dgvQuanLy.AlternatingRowsDefaultCellStyle.ForeColor = Color.Green;
            dgvQuanLy.AllowUserToAddRows = false;
            dgvQuanLy.AllowUserToDeleteRows = false;
            dgvQuanLy.AllowUserToResizeRows = false;
            dgvQuanLy.RowHeadersVisible = false;
            dgvQuanLy.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dgvQuanLy.MultiSelect = false;

            switch (Tag.ToString())
            {
                case "Rap":
                    Setup_dgv_Rap();
                    break;
                case "PhongChieu":
                    Setup_dgv_PhongChieu();
                    break;
                case "Phim":
                    Setup_dgv_Phim();
                    break;
                case "CaChieu":
                    Setup_dgv_CaChieu();
                    break;
                case "SuatChieu":
                    Setup_dgv_SuatChieu();
                    break;
                case "VeXemPhim":
                    Setup_dgv_VeXemPhim();
                    break;
                case "NhanVien":
                    Setup_dgv_TaiKhoan();
                    break;
                case "KhachHang":
                    Setup_dgv_TaiKhoan();
                    break;
                case "TTNhanVien":
                    Setup_dgv_TTNhanVien();
                    break;
                case "TTKhachHang":
                    Setup_dgv_TTKhachHang();
                    break;
                case "TTDatVe":
                    Setup_dgv_TTDatVe();
                    break;
                case "ChucVu":
                    Setup_dgv_ChucVu();
                    break;
                case "LoaiKyThuat":
                    Setup_dgv_LoaiKyThuat();
                    break;
                case "TrangThaiPhim":
                    Setup_dgv_TrangThaiPhim();
                    break;
                case "DienVien":
                    Setup_dgv_DienVien();
                    break;
                case "TheLoaiPhim":
                    Setup_dgv_TheLoaiPhim();
                    break;
                case "TinhTrangPhongChieu":
                    Setup_dgv_TinhTrangPhongChieu();
                    break;
                case "TTMuaVe":
                    Setup_dgv_TTMuaVe();
                    break;
                default:
                    break;
            }
        }

        void SetDefault_Chon()
        {
            foreach (DataGridViewRow row in dgvQuanLy.Rows)
            {
                if (row.Cells["Chon"].Value == null)
                {
                    row.Cells["Chon"].Value = "No";
                }
            }
        }

        private int DemXoaHan()
        {
            int dem = 0;
            foreach (DataGridViewRow row in dgvQuanLy.Rows)
            {
                if (row.Cells["Chon"].Value == "Yes" && int.Parse(row.Cells["DaXoa"].Value.ToString()) == 1)
                    dem += 1;
            }
            return dem;
        }

        private int DemChon()
        {
            int dem = 0;
            foreach (DataGridViewRow row in dgvQuanLy.Rows)
            {
                if (row.Cells["Chon"].Value == "Yes")
                    dem += 1;
            }
            return dem;
        }

        private int ChonDau()
        {
            for (int i = 0; i < dgvQuanLy.RowCount; i++)
            {
                if (dgvQuanLy.Rows[i].Cells["Chon"].Value.ToString() == "Yes")
                    return i;
            }
            return -1;
        }

        void Xoa()
        {
            switch (Tag.ToString())
            {
                case "Rap":
                    RapBUS RapBUS = new RapBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            RapBUS.Delete(int.Parse(row.Cells["MaRap"].Value.ToString()));
                        }
                    }
                    break;
                case "PhongChieu":
                    PhongChieuBUS PhongChieuBUS = new PhongChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            PhongChieuBUS.Delete(int.Parse(row.Cells["MaPhongChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "Phim":
                    PhimBUS PhimBUS = new PhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            PhimBUS.Delete(int.Parse(row.Cells["MaPhim"].Value.ToString()));
                        }
                    }
                    break;
                case "CaChieu":
                    CaChieuBUS CaChieuBUS = new CaChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            CaChieuBUS.Delete(int.Parse(row.Cells["MaCaChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "SuatChieu":
                    SuatChieuBUS SuatChieuBUS = new SuatChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            SuatChieuBUS.Delete(int.Parse(row.Cells["MaSuatChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "VeXemPhim":
                    VeBUS VeBUS = new VeBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            VeBUS.Delete(int.Parse(row.Cells["MaVe"].Value.ToString()));
                        }
                    }
                    break;
                case "NhanVien":
                    TaiKhoanBUS TaiKhoanNVBUS = new TaiKhoanBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TaiKhoanNVBUS.Delete(int.Parse(row.Cells["MaTaiKhoan"].Value.ToString()));
                        }
                    }
                    break;
                case "KhachHang":
                    TaiKhoanBUS TaiKhoanKHBUS = new TaiKhoanBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TaiKhoanKHBUS.Delete(int.Parse(row.Cells["MaTaiKhoan"].Value.ToString()));
                        }
                    }
                    break;
                case "TTNhanVien":
                    NhanVienBUS NhanVienBUS = new NhanVienBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            NhanVienBUS.Delete(int.Parse(row.Cells["MaNhanVien"].Value.ToString()));
                        }
                    }
                    break;
                case "TTKhachHang":
                    KhachHangBUS KhachHangBUS = new KhachHangBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            KhachHangBUS.Delete(int.Parse(row.Cells["MaKhachHang"].Value.ToString()));
                        }
                    }
                    break;
                case "TTDatVe":
                    TTDatVeBUS TTDatVeBUS = new TTDatVeBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TTDatVeBUS.Delete(int.Parse(row.Cells["MaTTDatVe"].Value.ToString()));
                        }
                    }
                    break;
                case "ChucVu":
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            ChucVuBUS.Delete(int.Parse(row.Cells["MaChucVu"].Value.ToString()));
                        }
                    }
                    break;
                case "TinhTrangPhongChieu":
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TinhTrangPhongChieuBUS.Delete(int.Parse(row.Cells["MaTinhTrangPhongChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "LoaiKyThuat":
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            LoaiKyThuatBUS.Delete(int.Parse(row.Cells["MaLoaiKyThuat"].Value.ToString()));
                        }
                    }
                    break;
                case "DienVien":
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            DienVienBUS.Delete(int.Parse(row.Cells["MaDienVien"].Value.ToString()));
                        }
                    }
                    break;
                case "TheLoaiPhim":
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TheLoaiPhimBUS.Delete(int.Parse(row.Cells["MaTheLoaiPhim"].Value.ToString()));
                        }
                    }
                    break;
                case "TrangThaiPhim":
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TrangThaiPhimBUS.Delete(int.Parse(row.Cells["MaTrangThaiPhim"].Value.ToString()));
                        }
                    }
                    break;
                default:
                    break;
            }
        }

        void BoXoa()
        {
            switch (Tag.ToString())
            {
                case "Rap":
                    RapBUS RapBUS = new RapBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            RapBUS.UnDelete(int.Parse(row.Cells["MaRap"].Value.ToString()));
                        }
                    }
                    break;
                case "PhongChieu":
                    PhongChieuBUS PhongChieuBUS = new PhongChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            PhongChieuBUS.UnDelete(int.Parse(row.Cells["MaPhongChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "Phim":
                    PhimBUS PhimBUS = new PhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            PhimBUS.UnDelete(int.Parse(row.Cells["MaPhim"].Value.ToString()));
                        }
                    }
                    break;
                case "CaChieu":
                    CaChieuBUS CaChieuBUS = new CaChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            CaChieuBUS.UnDelete(int.Parse(row.Cells["MaCaChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "SuatChieu":
                    SuatChieuBUS SuatChieuBUS = new SuatChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            SuatChieuBUS.UnDelete(int.Parse(row.Cells["MaSuatChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "VeXemPhim":
                    VeBUS VeBUS = new VeBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            VeBUS.UnDelete(int.Parse(row.Cells["MaVe"].Value.ToString()));
                        }
                    }
                    break;
                case "NhanVien":
                    TaiKhoanBUS TaiKhoanNVBUS = new TaiKhoanBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TaiKhoanNVBUS.UnDelete(int.Parse(row.Cells["MaTaiKhoan"].Value.ToString()));
                        }
                    }
                    break;
                case "KhachHang":
                    TaiKhoanBUS TaiKhoanKHBUS = new TaiKhoanBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TaiKhoanKHBUS.UnDelete(int.Parse(row.Cells["MaTaiKhoan"].Value.ToString()));
                        }
                    }
                    break;
                case "TTDatVe":
                    TTDatVeBUS TTDatVeBUS = new TTDatVeBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TTDatVeBUS.UnDelete(int.Parse(row.Cells["MaTTDatVe"].Value.ToString()));
                        }
                    }
                    break;
                case "ChucVu":
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            ChucVuBUS.UnDelete(int.Parse(row.Cells["MaChucVu"].Value.ToString()));
                        }
                    }
                    break;
                case "TinhTrangPhongChieu":
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TinhTrangPhongChieuBUS.UnDelete(int.Parse(row.Cells["MaTinhTrangPhongChieu"].Value.ToString()));
                        }
                    }
                    break;
                case "LoaiKyThuat":
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            LoaiKyThuatBUS.UnDelete(int.Parse(row.Cells["MaLoaiKyThuat"].Value.ToString()));
                        }
                    }
                    break;
                case "DienVien":
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            DienVienBUS.UnDelete(int.Parse(row.Cells["MaDienVien"].Value.ToString()));
                        }
                    }
                    break;
                case "TheLoaiPhim":
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TheLoaiPhimBUS.UnDelete(int.Parse(row.Cells["MaTheLoaiPhim"].Value.ToString()));
                        }
                    }
                    break;
                case "TrangThaiPhim":
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    foreach (DataGridViewRow row in dgvQuanLy.Rows)
                    {
                        if (row.Cells["Chon"].Value == "Yes")
                        {
                            TrangThaiPhimBUS.UnDelete(int.Parse(row.Cells["MaTrangThaiPhim"].Value.ToString()));
                        }
                    }
                    break;
                default:
                    break;
            }
        }

        void ThongTin(int _id)
        {
            pnThongTin.Controls.Clear();
            UserControl usc = null;
            switch (Tag.ToString())
            {
                case "Rap":
                    usc = new uscThemRap();
                    break;
                case "PhongChieu":
                    usc = new uscThemPhongChieu();
                    break;
                case "Phim":
                    usc = new uscThemPhim();
                    break;
                case "CaChieu":
                    usc = new uscThemCaChieu();
                    break;
                case "SuatChieu":
                    usc = new uscThemSuatChieu();
                    break;
                case "VeXemPhim":
                    usc = new uscThemVe();
                    break;
                case "NhanVien":
                    usc = new uscThemTaiKhoanNhanVien();
                    break;
                case "KhachHang":
                    usc = new uscThemTaiKhoanKhachHang();
                    break;
                case "TTNhanVien":
                    usc = new uscThemNhanVien();
                    break;
                case "TTKhachHang":
                    usc = new uscThemKhachHang();
                    break;
                case "TTDatVe":
                    usc = new ucsThemTTDatVe();
                    break;
                case "ChucVu":
                    usc = new uscThemChucVu();
                    break;
                case "DienVien":
                    usc = new uscThemDienVien();
                    break;
                case "TinhTrangPhongChieu":
                    usc = new uscThemTinhTrangPhongChieu();
                    break;
                case "LoaiKyThuat":
                    usc = new uscThemLoaiKyThuat();
                    break;
                case "TrangThaiPhim":
                    usc = new uscThemTrangThaiPhim();
                    break;
                case "TheLoaiPhim":
                    usc = new ucsThemTheLoaiPhim();
                    break;
                case "TTMuaVe":
                    usc = new UserControl();
                    break;
                default:
                    break;
            }
            usc.Tag = _id;
            pnThongTin.Controls.Add(usc);
        }

        string LayTenCot()
        {
            string colname = "";
            switch (Tag.ToString())
            {
                case "VeXemPhim":
                    colname = "MaVe";
                    break;
                case "NhanVien":
                case "KhachHang":
                    colname = "MaTaiKhoan";
                    break;
                case "TTNhanVien":
                    colname = "MaNhanVien";
                    break;
                case "TTKhachHang":
                    colname = "MaKhachHang";
                    break;
                default:
                    colname = "Ma" + Tag.ToString();
                    break;
            }
            return colname;
        }

        void Load_pnThongTin()
        {
            if (dgvQuanLy.RowCount <= 0)
            {
                int id = -1;
                ThongTin(id);
            }
        }

        private void TimTheoTen_QL(string Ten)
        {
            dgvQuanLy.Columns.Clear();
            lbKhongCoDuLieu.Visible = false;
            string TenMucTimKiem = "";
            switch (Tag.ToString())
            {
                case "Rap":
                    TenMucTimKiem = "Rạp";
                    RapBUS BUS_Rap = new RapBUS();
                    BindingList<RapDTO> DanhSach_Rap = BUS_Rap.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_Rap;
                    break;
                case "PhongChieu":
                    TenMucTimKiem = "phòng chiếu";
                    PhongChieuBUS BUS_PhongChieu = new PhongChieuBUS();
                    BindingList<PhongChieuDTO> DanhSach_PhongChieu = BUS_PhongChieu.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_PhongChieu;
                    break;
                case "Phim":
                    TenMucTimKiem = "phim";
                    PhimBUS BUS_Phim = new PhimBUS();
                    BindingList<PhimDTO> DanhSach_Phim = BUS_Phim.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_Phim;
                    break;
                case "CaChieu":
                    TenMucTimKiem = "ca chiếu";
                    CaChieuBUS BUS_CaChieu = new CaChieuBUS();
                    BindingList<CaChieuDTO> DanhSach_CaChieu = BUS_CaChieu.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_CaChieu;
                    break;
                case "SuatChieu":
                    TenMucTimKiem = "suất chiếu";
                    SuatChieuBUS BUS_SuatChieu = new SuatChieuBUS();
                    BindingList<SuatChieuDTO> DanhSach_SuatChieu = BUS_SuatChieu.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_SuatChieu;
                    break;
                case "VeXemPhim":
                    //VeBUS BUS_Ve = new VeBUS();
                    //BindingList<VeDTO> DanhSach_Ve = BUS_Ve.GetListLikeName_QL(Ten);
                    //dgvQuanLy.DataSource = DanhSach_Ve;
                    break;
                case "NhanVien":
                    TenMucTimKiem = "tài khoản nhân viên";
                    TaiKhoanBUS BUS_NhanVien = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_NhanVien = BUS_NhanVien.GetListListLikeName_NhanVien_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_NhanVien;
                    break;
                case "KhachHang":
                    TenMucTimKiem = "tài khoản khách";
                    TaiKhoanBUS BUS_KhachHang = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_KhachHang = BUS_KhachHang.GetListListLikeName_KhachHang_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_KhachHang;
                    break;
                case "TTNhanVien":
                    TenMucTimKiem = "nhân viên";
                    NhanVienBUS NhanVienBUS = new NhanVienBUS();
                    BindingList<NhanVienDTO> DanhSach_TTNhanVien = NhanVienBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_TTNhanVien;
                    break;
                case "TTKhachHang":
                    TenMucTimKiem = "khách hàng";
                    KhachHangBUS KhachHangBUS = new KhachHangBUS();
                    BindingList<KhachHangDTO> DanhSach_TTKhachHang = KhachHangBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_TTKhachHang;
                    break;
                case "TTDatVe":
                    //TTDatVeBUS BUS_TTDatVe = new TTDatVeBUS();
                    //BindingList<TTDatVeDTO> DanhSach_TTDatVe = BUS_TTDatVe.GetListLikeName_QL(Ten);
                    //dgvQuanLy.DataSource = DanhSach_TTDatVe;
                    break;
                case "ChucVu":
                    TenMucTimKiem = "chức vụ";
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    BindingList<ChucVuDTO> DanhSach_ChucVu = ChucVuBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_ChucVu;
                    break;
                case "TrangThaiPhim":
                    TenMucTimKiem = "trạng thái phim";
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    BindingList<TrangThaiPhimDTO> DanhSach_TrangThaiPhim = TrangThaiPhimBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_TrangThaiPhim;
                    break;
                case "TheLoaiPhim":
                    TenMucTimKiem = "thẻ loại phim";
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    BindingList<TheLoaiPhimDTO> DanhSach_TheLoaiPhim = TheLoaiPhimBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_TheLoaiPhim;
                    break;
                case "DienVien":
                    TenMucTimKiem = "diễn viên";
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    BindingList<DienVienDTO> DanhSach_DienVien = DienVienBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_DienVien;
                    break;
                case "LoaiKyThuat":
                    TenMucTimKiem = "loại kỹ thuật";
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    BindingList<LoaiKyThuatDTO> DanhSach_LoaiKyThuat = LoaiKyThuatBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_LoaiKyThuat;
                    break;
                case "TinhTrangPhongChieu":
                    TenMucTimKiem = "tình trạng";
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    BindingList<TinhTrangPhongChieuDTO> DanhSach_TinhTrangPhongChieu = TinhTrangPhongChieuBUS.GetListLikeName_QL(Ten);
                    dgvQuanLy.DataSource = DanhSach_TinhTrangPhongChieu;
                    break;
                case "TTMuaVe":
                    //btnBoXoa.Enabled = false;
                    //btnXoa.Enabled = false;
                    //btnDanhSachDaXoa.Enabled = false;
                    //TTMuaVeBUS TTMuaVeBUS = new TTMuaVeBUS();
                    //BindingList<TTMuaVeDTO> DanhSach_TTMuaVe = TTMuaVeBUS.GetList_QL();
                    //dgvQuanLy.DataSource = DanhSach_TTMuaVe;
                    break;
                default:
                    break;
            }
            if (dgvQuanLy.Rows.Count == 0)
            {
                lbKhongCoDuLieu.Text = "Không có " + TenMucTimKiem + " có tên này.";
                lbKhongCoDuLieu.Visible = true;
            }
        }

        private void TimTheoTen_QL_DaXoa(string Ten)
        {
            dgvQuanLy.Columns.Clear();
            switch (Tag.ToString())
            {
                case "Rap":
                    RapBUS BUS_Rap = new RapBUS();
                    BindingList<RapDTO> DanhSach_Rap = BUS_Rap.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_Rap;
                    break;
                case "PhongChieu":
                    PhongChieuBUS BUS_PhongChieu = new PhongChieuBUS();
                    BindingList<PhongChieuDTO> DanhSach_PhongChieu = BUS_PhongChieu.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_PhongChieu;
                    break;
                case "Phim":
                    PhimBUS BUS_Phim = new PhimBUS();
                    BindingList<PhimDTO> DanhSach_Phim = BUS_Phim.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_Phim;
                    break;
                case "CaChieu":
                    CaChieuBUS BUS_CaChieu = new CaChieuBUS();
                    BindingList<CaChieuDTO> DanhSach_CaChieu = BUS_CaChieu.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_CaChieu;
                    break;
                case "SuatChieu":
                    SuatChieuBUS BUS_SuatChieu = new SuatChieuBUS();
                    BindingList<SuatChieuDTO> DanhSach_SuatChieu = BUS_SuatChieu.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_SuatChieu;
                    break;
                case "VeXemPhim":
                    //VeBUS BUS_Ve = new VeBUS();
                    //BindingList<VeDTO> DanhSach_Ve = BUS_Ve.GetListLikeName_QL_DaXoa(Ten);
                    //dgvQuanLy.DataSource = DanhSach_Ve;
                    break;
                case "NhanVien":
                    TaiKhoanBUS BUS_NhanVien = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_NhanVien = BUS_NhanVien.GetListListLikeName_NhanVien_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_NhanVien;
                    break;
                case "KhachHang":
                    TaiKhoanBUS BUS_KhachHang = new TaiKhoanBUS();
                    BindingList<TaiKhoanDTO> DanhSach_KhachHang = BUS_KhachHang.GetListListLikeName_KhachHang_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_KhachHang;
                    break;
                case "TTNhanVien":
                    NhanVienBUS NhanVienBUS = new NhanVienBUS();
                    BindingList<NhanVienDTO> DanhSach_TTNhanVien = NhanVienBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_TTNhanVien;
                    break;
                case "TTKhachHang":
                    KhachHangBUS KhachHangBUS = new KhachHangBUS();
                    BindingList<KhachHangDTO> DanhSach_TTKhachHang = KhachHangBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_TTKhachHang;
                    break;
                case "TTDatVe":
                    //TTDatVeBUS BUS_TTDatVe = new TTDatVeBUS();
                    //BindingList<TTDatVeDTO> DanhSach_TTDatVe = BUS_TTDatVe.GetListLikeName_QL_DaXoa(Ten);
                    //dgvQuanLy.DataSource = DanhSach_TTDatVe;
                    break;
                case "ChucVu":
                    ChucVuBUS ChucVuBUS = new ChucVuBUS();
                    BindingList<ChucVuDTO> DanhSach_ChucVu = ChucVuBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_ChucVu;
                    break;
                case "TrangThaiPhim":
                    TrangThaiPhimBUS TrangThaiPhimBUS = new TrangThaiPhimBUS();
                    BindingList<TrangThaiPhimDTO> DanhSach_TrangThaiPhim = TrangThaiPhimBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_TrangThaiPhim;
                    break;
                case "TheLoaiPhim":
                    TheLoaiPhimBUS TheLoaiPhimBUS = new TheLoaiPhimBUS();
                    BindingList<TheLoaiPhimDTO> DanhSach_TheLoaiPhim = TheLoaiPhimBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_TheLoaiPhim;
                    break;
                case "DienVien":
                    DienVienBUS DienVienBUS = new DienVienBUS();
                    BindingList<DienVienDTO> DanhSach_DienVien = DienVienBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_DienVien;
                    break;
                case "LoaiKyThuat":
                    LoaiKyThuatBUS LoaiKyThuatBUS = new LoaiKyThuatBUS();
                    BindingList<LoaiKyThuatDTO> DanhSach_LoaiKyThuat = LoaiKyThuatBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_LoaiKyThuat;
                    break;
                case "TinhTrangPhongChieu":
                    TinhTrangPhongChieuBUS TinhTrangPhongChieuBUS = new TinhTrangPhongChieuBUS();
                    BindingList<TinhTrangPhongChieuDTO> DanhSach_TinhTrangPhongChieu = TinhTrangPhongChieuBUS.GetListLikeName_QL_DaXoa(Ten);
                    dgvQuanLy.DataSource = DanhSach_TinhTrangPhongChieu;
                    break;
                case "TTMuaVe":
                    //btnBoXoa.Enabled = false;
                    //btnXoa.Enabled = false;
                    //btnDanhSachDaXoa.Enabled = false;
                    //TTMuaVeBUS TTMuaVeBUS = new TTMuaVeBUS();
                    //BindingList<TTMuaVeDTO> DanhSach_TTMuaVe = TTMuaVeBUS.GetList_QL_DaXoa();
                    //dgvQuanLy.DataSource = DanhSach_TTMuaVe;
                    break;
                default:
                    break;
            }
        }

    }
}
